-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
-- PURPOSE.
-- See the Mulan PSL v2 for more details.
--
-- Author: auto generate
-- Create: 2025-7-27
-- Description: DO NOT EDIT; Code generated by "message.lua.mako"
local validate = require 'mc.validate'
local utils = require 'mc.utils'
local mdb = require 'mc.mdb'

local Status = {}

---@class Status.CommunicationStatus
---@field CommunicationStatus integer
local TCommunicationStatus = {}
TCommunicationStatus.__index = TCommunicationStatus
TCommunicationStatus.group = {}

local function TCommunicationStatus_from_obj(obj)
    return setmetatable(obj, TCommunicationStatus)
end

function TCommunicationStatus.new(CommunicationStatus)
    return TCommunicationStatus_from_obj({CommunicationStatus = CommunicationStatus or 1})
end
---@param obj Status.CommunicationStatus
function TCommunicationStatus:init_from_obj(obj)
    self.CommunicationStatus = obj.CommunicationStatus or 1
end

function TCommunicationStatus:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TCommunicationStatus.group)
end

TCommunicationStatus.from_obj = TCommunicationStatus_from_obj

TCommunicationStatus.proto_property = {'CommunicationStatus'}

TCommunicationStatus.default = {0}

TCommunicationStatus.struct = {{name = 'CommunicationStatus', is_array = false, struct = nil}}

function TCommunicationStatus:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'CommunicationStatus', self.CommunicationStatus, 'uint8', true, errs, need_convert)

    TCommunicationStatus:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TCommunicationStatus.proto_property, errs, need_convert)
    return self
end

function TCommunicationStatus:unpack(_)
    return self.CommunicationStatus
end

Status.CommunicationStatus = TCommunicationStatus

---@class Status.ActiveStatus
---@field ActiveStatus integer
local TActiveStatus = {}
TActiveStatus.__index = TActiveStatus
TActiveStatus.group = {}

local function TActiveStatus_from_obj(obj)
    return setmetatable(obj, TActiveStatus)
end

function TActiveStatus.new(ActiveStatus)
    return TActiveStatus_from_obj({ActiveStatus = ActiveStatus})
end
---@param obj Status.ActiveStatus
function TActiveStatus:init_from_obj(obj)
    self.ActiveStatus = obj.ActiveStatus
end

function TActiveStatus:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TActiveStatus.group)
end

TActiveStatus.from_obj = TActiveStatus_from_obj

TActiveStatus.proto_property = {'ActiveStatus'}

TActiveStatus.default = {0}

TActiveStatus.struct = {{name = 'ActiveStatus', is_array = false, struct = nil}}

function TActiveStatus:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'ActiveStatus', self.ActiveStatus, 'uint8', true, errs, need_convert)

    TActiveStatus:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TActiveStatus.proto_property, errs, need_convert)
    return self
end

function TActiveStatus:unpack(_)
    return self.ActiveStatus
end

Status.ActiveStatus = TActiveStatus

Status.interface = mdb.register_interface('bmc.kepler.Managers.ActiveStandby.Status', {
    ActiveStatus = {'y', {'EMIT_CHANGE'}, true, nil, false},
    CommunicationStatus = {'y', {'EMIT_CHANGE'}, true, 1, false}
}, {}, {})

return Status
